package ch6;

public class BubbleSort {

	public static void main(String[] args) {
		int[] ar = { 16, 25, 9, 90, 23, 14, 15 };
		int temp;
		for (int i = 0; i < ar.length - 1; i++) {
			for (int j = 0; j < ar.length - 1 - i; j++) {
				// ar[j]和ar[j+1]
				if (ar[j] > ar[j + 1]) {
					temp = ar[j];
					ar[j] = ar[j + 1];
					ar[j + 1] = temp;
				}
			}
		}
		System.out.println("排序后：");
		for (int i : ar) {
			System.out.print(i + " ");
		}
	}

}
